package cn.leida;

/**
 * @author lei
 * @create 2025-03-11 18:37
 */

import cn.leida.base.cmd.RunCmdUtil;
import cn.leida.ruoyi.common.config.AppConfig;
import cn.leida.ruoyi.common.config.AppServerConfig;
import cn.leida.util.AppPidUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 启动程序
 *
 * @author lei
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
//@ComponentScan(basePackages = "cn.leida")
@EnableScheduling // 定时任务
public class AdminLocalApplication {

    public static void main(String[] args) {
        // 启动加锁
        AppPidUtil.lockApp();
        AppConfig.changeDB(false);
        AppConfig.showDoc(false);
        // 初始化浏览器驱动
        // PlayLoginUtil.initPlaywright();
        ConfigurableApplicationContext ctx = SpringApplication.run(AdminLocalApplication.class, args);
        System.out.println("============local===success=============");
        System.out.println("============local===success=============");
        System.out.println("============local===success=============");

        AppServerConfig cfg = ctx.getBean(AppServerConfig.class);
        RunCmdUtil.openUrl(cfg.localUrl("index.html"));

    }
}
